home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / nivb / dirdrive.frm < prev    next >
Text File  |  1995-05-07  |  3KB  |  80 lines

  1. VERSION 2.00
  2. Begin Form DirDriveForm 
  3.    Caption         =   "Directory Services Test (Drive APIs)"
  4.    ClientHeight    =   3000
  5.    ClientLeft      =   870
  6.    ClientTop       =   1530
  7.    ClientWidth     =   6360
  8.    Height          =   3405
  9.    Left            =   810
  10.    LinkTopic       =   "Form2"
  11.    ScaleHeight     =   3000
  12.    ScaleWidth      =   6360
  13.    Top             =   1185
  14.    Width           =   6480
  15.    Begin ListBox DriveList 
  16.       Height          =   1980
  17.       Left            =   120
  18.       TabIndex        =   1
  19.       Top             =   360
  20.       Width           =   6135
  21.    End
  22.    Begin CommandButton OKButton 
  23.       Caption         =   "&OK"
  24.       Height          =   372
  25.       Left            =   3000
  26.       TabIndex        =   0
  27.       Top             =   2520
  28.       Width           =   732
  29.    End
  30.    Begin Label Label2 
  31.       Caption         =   "* Search drives"
  32.       Height          =   252
  33.       Left            =   120
  34.       TabIndex        =   3
  35.       Top             =   2400
  36.       Width           =   1332
  37.    End
  38.    Begin Label Label1 
  39.       Caption         =   "Network drive mappings"
  40.       Height          =   252
  41.       Left            =   120
  42.       TabIndex        =   2
  43.       Top             =   120
  44.       Width           =   2172
  45.    End
  46. End
  47.  
  48. Sub OKButton_Click ()
  49.     Unload DirDriveForm
  50. End Sub
  51.  
  52. Sub Form_Load ()
  53.     'DriveList.Clear
  54.  
  55.     For drive% = 0 To 25
  56.         ccode% = GetDriveInformation(drive%, connID%, dirHandle%)
  57.         If (dirHandle% <> 0) Then
  58.             dirPath$ = String$(255, 0)
  59.             ccode% = GetDirectoryPath(dirHandle%, dirPath$)
  60.             dirPath$ = Left$(dirPath$, InStr(dirPath$, Chr$(0)) - 1)
  61.             If (ccode% = SUCCESSFUL) Then
  62.                 fileServerName$ = String$(48, 0)
  63.                 GetFileServerName connID%, fileServerName$
  64.                 fileServerName$ = Left$(fileServerName$, InStr(fileServerName$, Chr$(0)) - 1)
  65.         
  66.                 If (IsSearchDrive(drive% + 65) = 1) Then
  67.                     DriveList.AddItem "* " + Chr$(drive% + 65) + ":   " + fileServerName$ + "/" + dirPath$
  68.                 Else
  69.                     DriveList.AddItem "  " + Chr$(drive% + 65) + ":   " + fileServerName$ + "/" + dirPath$
  70.                 End If
  71.             Else
  72.                 DriveList.AddItem "Can't get path for this drive"
  73.             End If
  74.         ElseIf (ccode% <> SUCCESSFUL) Then
  75.               DriveList.AddItem "  " + Chr$(drive% + 65) + ":   " + "Mapped to a local drive"
  76.         End If
  77.     Next drive%
  78. End Sub
  79.  
  80.